package org.numanint.code;

import java.util.HashMap;


public class DaoGenerator extends Generator {
	
	public DaoGenerator(GeneratorProperties p){
		super(p);
	}
	
	public void generator(ReverseEngineer reveng) throws Exception{	
			HashMap<String,Object> data = new HashMap<String,Object>();
			for(int i=0;i<reveng.getTableClasss().length;i++){	
				String className = ConventUtils.t2c(reveng.getTableClasss()[i].getTableName());		
				HashMap<String,Object> tableMap = new HashMap<String,Object>();
				tableMap.put("properties", getProperties());
				tableMap.put("className", className);			
				data.put(className+"DAO.java", tableMap);
			} 
			if(getProperties().getDaoPkgName()!=null) 
				setOutputDir(getOutputDir()+getProperties().getDaoPkgName().replace('.',System.getProperty("file.separator").charAt(0)));

			super.setData(data);
			super.generator();
		
	}	
}
